package com.miukoo.aikao.core.utils;

import com.miukoo.aikao.core.pojos.SecurityUser;

/**
 *  当前登录用户
　* @Author miukoo<miukoo@126.com>
　* @Date 2020/11/19 19:43
　* @Version 1.0
  */
public class AppUserUtils {

    private final static ThreadLocal<SecurityUser> USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 设置当前线程中的用户
     * @param securityUser
     */
    public static void setUser(SecurityUser securityUser){
        USER_THREAD_LOCAL.set(securityUser);
    }

    /**
     * 获取当前线程中的用户
     * @return
     */
    public static SecurityUser getUser(){
        return USER_THREAD_LOCAL.get();
    }
}
